#ifndef WHEEL_MODULE_HPP
#define WHEEL_MODULE_HPP
#include <string>
#include <stdlib.h>

#define SPEED_MAX 4096
class wheel_module
{
    public:
        wheel_module(){cur_err=0;last_err=0;for(int i=0;i<20;i++) prev_err[i]=0;}
        ~wheel_module(){}
        float convert_speed_to_line(int sp);    //转速转换成线速度
        int convert_line_to_speed(float lin);   //线速度转换成转速
        int conclude(void);
        void set_angle_cur(int16_t agt){angle_cur=agt;} 
        void set_module_speed(int sp);
        void set_module_angle(int ag){angle_set=ag;}
        int16_t speed_set_L=0,speed_set_R=0;
    private:
        int16_t angle_cur=0;
        int16_t angle_set=0;
        int16_t speed_cur_L=0,speed_cur_R=0;
        
        int16_t speed_module_cur=0,speed_module_set=0;
        int16_t speed_limit=SPEED_MAX;
        //pid
         float cur_err,last_err,prev_err[20];
};

#endif